//
// Created by 123 on 2024/12/30.
//
#include "iostream"
using namespace std;

int* func(){
    //在堆区开辟空间
    int* a = new int(10);
    return a;
}

int main041(){
    //new int
    int* p = func();
    cout << *p << endl;
    cout << *p << endl;
    delete p;
//    cout << *p << endl;
    //new array
    int* arr = new int[10];
    for (int i = 0; i < 10; ++i) {
        arr[i] = i+100;
    }
    for (int i = 0; i < 10; ++i) {
        cout << arr[i] << endl;
    }
    delete[] arr;
    return 0;
}